(defvar gnarly-mode-hook nil)

(add-to-list 'auto-mode-alist '("\\.nr\\'" . gnarly-mode))

(defconst gnarly-font-lock-keywords-1
  (list
   '("/\\*[^\\*/]*\\*/\\|//.*" . font-lock-comment-face)
   '("\\<\\(/\\(?:if\\|match\\)\\|else\\|if\\*?\\|match\\*?\\|then\\|using\\|with\\)\\>" . font-lock-keyword-face)
   '("\\b[a-z_][a-zA-Z0-9_]*'*\\b" . nil)
   '("\\b[A-Z][a-zA-Z0-9_]*\\b" . font-lock-type-face)    
   '("\\b-?[0-9]+\\.?\\b\\|\\b-?\\.?[0-9]+\\b\\|#t\\|#f" . font-lock-constant-face)
   '("=>\\|->\\|<-\\||\\|::\\|:=\\|,\\|&" . font-lock-function-name-face)
   '(">\\|<\\|=\\|\\+\\|\\^\\|\\*\\|-\\|/\\|%\\|||\\|&&" . font-lock-function-name-face)))

(defvar gnarly-font-lock-keywords gnarly-font-lock-keywords-1)

(define-derived-mode gnarly-mode fundamental-mode "Gnarly" "Major mode for editing Gnarly files" 
   (set (make-local-variable 'font-lock-defaults) '(gnarly-font-lock-keywords)))

(provide 'gnarly-mode)